home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PLAYBOY - 20 Anos
/
PLAYBOY - 20 Anos.img
/
instalar.ms_
/
instalar.ms
Wrap
Text File
|
1995-11-09
|
9KB
|
336 lines
'**************************************************************************
'* Instalaτπo do PLAYBOY CD-ROM 95
'**************************************************************************
'$DEFINE DEBUG ''Define for script development/debugging
'$INCLUDE 'setupapi.inc'
'$INCLUDE 'msdetect.inc'
''Dialog ID's
CONST ASKLANG = 100
CONST ASKQUIT = 200
CONST EXITFAILURE = 400
CONST EXITQUIT = 600
CONST OPTIONS = 800
CONST APPHELP = 900
CONST ACTIVATEFONTS = 1300
CONST RESTARTWIN = 1500
CONST DESTPATH = 1700
CONST TOOBIG = 6300
CONST WS_VISIBLE=&H10000000
CONST WS_BORDER =&H00800000
CONST WS_CLIPCHILDREN =&H02000000
CONST GWL_STYLE =-16
CONST SW_SHOWMAXIMIZED=3
''Bitmap ID
CONST FUNDO = 1
GLOBAL szInf$
GLOBAL CUIDLL$ ''Define o nome da DLL a ser uasada.
GLOBAL CDROM$ ''Diret≤rio Default do CD-ROM.
GLOBAL DEST$ ''Diret≤rio Default de Destino.
GLOBAL OPTCUR$ ''Opτπo de Seleτπo das Dialog Boxes.
GLOBAL SRCDIR$ ''Mensagens de configuraτπo
GLOBAL ASYM$ ''Diret≤rio do ASYM.INI
GLOBAL WININI$ ''Diret≤rio do WIN.INI
GLOBAL SYSINI$ ''Diret≤rio do SYSTEM.INI
GLOBAL PBOYINI$
GLOBAL SPACOL&
GLOBAL SPACOS&
GLOBAL SaidaA$
GLOBAL SaidaB$
GLOBAL ErroFontes$
GLOBAL Lang%
'Gostou...
DECLARE SUB Install
DECLARE SUB BackupInis (Extensao$)
DECLARE FUNCTION MakePath (szDir$, szFile$) AS STRING
DECLARE FUNCTION ShowWindow LIB "user.exe" (hWnd%,iShow%) AS INTEGER
DECLARE FUNCTION SetWindowLong LIB "user.exe" (hWnd%, offset%, style&) AS LONG
'**************************************************************************
'** Script Geral de Instalaτπo
'**************************************************************************
hWnd%=HwndFrame()
i1&=SetWindowLong(hWnd%,GWL_STYLE,WS_VISIBLE+WS_BORDER+WS_CLIPCHILDREN)
j1%=ShowWindow(hWnd%,SW_SHOWMAXIMIZED)
INIT:
SPACOS& = 16000000
SPACOL& = 67000000
SPACO& = SPACOS&
CUIDLL$ = "mscuistf.dll" ''Custom user interface dll
OPTCUR$ = "I"
HELPPROC$ = "FHelpDlgProc" ''Help dialog procedure
SaidaA$ = "O Windows serß reiniciado e o CD-ROM PLAYBOY estarß pronto para ser executado."
SaidaB$ = "O CD-ROM PLAYBOY nπo estarß pronto atΘ que o Windows seja reiniciado."
ErroFontes$ = "As fontes da Instalaτπo foram corrompidas. Procure Suporte TΘcnico."
SetBitmap CUIDLL$, FUNDO
SetTitle "CD-ROM PLAYBOY 20 ANOS"
szInf$ = GetSymbolValue("STF_SRCINFPATH")
IF szInf$ = "" THEN
szInf$ = GetSymbolValue("STF_CWDDIR") + "PBOY.INF"
END IF
ReadInfFile szInf$
SRCDIR$ = GetSymbolValue("STF_SRCDIR")
CDROM$ = MID$(SRCDIR$,1,3)
WININI$ = MakePath(GetWindowsDir(),"WIN.INI")
SYSINI$ = MakePath(GetWindowsDir(),"SYSTEM.INI")
PBOYINI$ = MakePath(GetWindowsDir(),"PBOY.INI")
'$IFDEF DEBUG
i% = SetSizeCheckMode(scmOnIgnore) '' could use scmOff; def = scmOnFatal
WinDrive$ = MID$(GetWindowsDir, 1, 1)
DEST$ = WinDrive$
IF IsDriveValid(WinDrive$) = 0 THEN
i% = DoMsgBox("Invalid Windows drive ('"+WinDrive$+"').", "DEBUG", MB_TASKMODAL+MB_ICONHAND+MB_OK)
GOTO QUIT
END IF
'$ENDIF ''DEBUG
GETPATH:
DEST$ = "C:\PBOY20"
SetSymbolValue "EditTextIn", DEST$
SetSymbolValue "EditFocus", "END"
GETPATHL1:
sz$ = UIStartDlg(CUIDLL$, DESTPATH, "FEditDlgProc", APPHELP, HELPPROC$)
DEST$ = GetSymbolValue("EditTextOut")
IF sz$ = "CONTINUE" THEN
IF IsDirWritable(DEST$) = 0 THEN
GOSUB BADPATH
GOTO GETPATHL1
DEST$ = "C:\PBOY20"
END IF
ELSEIF sz$ = "REACTIVATE" THEN
GOTO GETPATHL1
ELSE
GOSUB ASKQUIT
GOTO GETPATH
END IF
'Testa o espaco disponivel no CD-ROM
IF GetFreeSpaceForDrive( MID$( DEST$, 1, 1 ) ) < SPACO& THEN
GOSUB DRIVEFULL
GOTO GETPATHL1
END IF
UIPop 1
''*************************************************************************
Install
''*************************************************************************
' ERR = 0
' sz$ = UIStartDlg(CUIDLL$, ACTIVATEFONTS, "FInstFontDlgProc", 0, "")
' UIPop 1
' GOTO QUIT
QUIT:
ON ERROR GOTO ERRQUIT
IF ERR = 0 THEN
''Opτπo de reinicializar o Windows
dlg% = RESTARTWIN
ELSEIF ERR = STFQUIT THEN
dlg% = EXITQUIT
ELSE
dlg% = EXITFAILURE
END IF
QUITL1:
sz$ = UIStartDlg(CUIDLL$, dlg%, "FInfo0DlgProc", 0, "")
IF sz$ = "REACTIVATE" THEN
GOTO QUITL1
ELSEIF sz$ = "RESTART" THEN
i% = DoMsgBox( SaidaA$, "Instalaτπo", MB_OK+MB_TASKMODAL+MB_ICONHAND)
ELSEIF sz$ = "EXIT" THEN
i% = DoMsgBox( SaidaB$, "Instalaτπo", MB_OK+MB_TASKMODAL+MB_ICONHAND)
END IF
UIPop 1
END
sz$ = UIStartDlg(CUIDLL$, dlg%, "FInfo0DlgProc", 0, "")
IF sz$ = "REACTIVATE" THEN ''Se o OK foi apertado...
GOTO QUITL1
END IF
ERRQUIT:
i% = DoMsgBox(ErroFontes$, "Instalaτπo", MB_OK+MB_TASKMODAL+MB_ICONHAND)
END
DRIVEFULL:
sz$ = UIStartDlg(CUIDLL$, TOOBIG, "FInfo0DlgProc", 0, "")
IF sz$ = "REACTIVATE" THEN
GOTO DRIVEFULL
END IF
UIPop 1
RETURN
BADPATH:
sz$ = UIStartDlg(CUIDLL$, BADPATH, "FInfo0DlgProc", 0, "")
IF sz$ = "REACTIVATE" THEN
GOTO BADPATH
END IF
UIPop 1
RETURN
ASKQUIT:
sz$ = UIStartDlg(CUIDLL$, ASKQUIT, "FQuitDlgProc", 0, "")
IF sz$ = "EXIT" THEN
UIPopAll
ERROR STFQUIT
ELSEIF sz$ = "REACTIVATE" THEN
GOTO ASKQUIT
ELSE
UIPop 1
END IF
RETURN
'**
'** Purpose:
'** Builds the copy list and performs all installation operations.
'** Arguments:
'** none.
'** Returns:
'** none.
'*************************************************************************
SUB Install STATIC
SrcDir$ = GetSymbolValue("STF_SRCDIR")
BackupInis("PBY")
''Adiciona linhas de Animaτπo, Video Digital no Win.INI
CreateIniKeyValue WININI$,"MCI Extensions","avi","Avivideo", cmoAppend
'Adiciona linha no VIEWER.INI
CreateIniKeyValue MakePath(GetWindowsDir(), "VIEWER.INI"),"FILES", "PLAYBOY.MVB", SrcDir$+"\, Por favor insira o CD-ROM PLAYBOY 20 Anos no drive de CD.", cmoOverwrite
''Adiciona linhas no System.INI
CreateIniKeyValue SYSINI$,"MCI", "Avivideo","mciavi.drv", cmoAppend
CreateIniKeyValue SYSINI$,"Drivers","vidc.cvid","iccvid.drv", cmoAppend
CreateIniKeyValue SYSINI$,"Drivers","vidc.iv31","ir32.dll", cmoAppend
CreateIniKeyValue SYSINI$,"Drivers","vidc.iv32","ir32.dll", cmoAppend
CreateIniKeyValue PBOYINI$,"Pboy","DirMidias1",SrcDir$, cmoOverwrite
CreateIniKeyValue PBOYINI$,"Pboy","DirMidias2",SrcDir$, cmoOverwrite
CreateIniKeyValue PBOYINI$,"Pboy","DirMidias3",DEST$+"\", cmoOverwrite
CreateIniKeyValue PBOYINI$,"Pboy","DirMidias4",DEST$+"\", cmoOverwrite
CreateIniKeyValue PBOYINI$,"Pboy","Profile","640480", cmoOverwrite
DIR$ = DEST$
''Instala arquivos da seτπo COMUM
AddSectionFilesToCopyList "Comum", SrcDir$, Dest$
''Instala arquivos da seτπo TRILHAS
AddSectionFilesToCopyList "Trilhas", SrcDir$, MakePath(Dest$,"MIDIAS")
''Instala arquivos da seτπo SYSTEM
AddSectionFilesToCopyList "System", SrcDir$, MakePath(GetWindowsDir(),"SYSTEM")
SetCopyGaugePosition 90, 115
CopyFilesInCopyList
'' Cria o grupo
CreateProgmanGroup "CD-ROM PLAYBOY 20 Anos", "", cmoOverwrite
ShowProgmanGroup "CD-ROM PLAYBOY 20 Anos", 1, cmoOverwrite
'' Cria os φcones
CreateProgmanItem "CD-ROM PLAYBOY 20 Anos", "PLAYBOY 20 Anos", MakePath(Dest$,"PBOY20.EXE") ,MakePath(DEST$,"PBOY20.EXE"), cmoOverwrite
CreateProgmanItem "CD-ROM PLAYBOY 20 Anos", "Ajuda", MakePath(SrcDir$,"HELP\MVIEWER2.EXE ")+MakePath(SrcDir$,"HELP\PLAYBOY.MVB") ,MakePath(DEST$,"PBOY.DLL")+",0,0,"+MakePath(SrcDir$,"HELP"), cmoOverwrite
Run ("profdisp.exe")
END SUB
'**
'**
'** Purpose:
'** Appends a file name to the end of a directory path,
'** inserting a backslash character as needed.
'** Arguments:
'** szDir$ - full directory path (with optional ending "\")
'** szFile$ - filename to append to directory
'** Gace Avestruz
'** Returns:
'** Resulting fully qualified path name.
'*************************************************************************
FUNCTION MakePath (szDir$, szFile$) STATIC AS STRING
IF szDir$ = "" THEN
MakePath = szFile$
ELSEIF szFile$ = "" THEN
MakePath = szDir$
ELSEIF MID$(szDir$, LEN(szDir$), 1) = "\" THEN
MakePath = szDir$ + szFile$
ELSE
MakePath = szDir$ + "\" + szFile$
END IF
END FUNCTION
'*************************************************************************
SUB BackupInis(Extensao$) STATIC
WINBACK$ = MakePath(GetWindowsDir(),"WIN."+Extensao$)
SYSBACK$ = MakePath(GetWindowsDir(),"SYSTEM."+Extensao$)
IF EXISTS (WINBACK$) THEN
KILL WINBACK$
END IF
IF EXISTS (SYSBACK$) THEN
KILL SYSBACK$
END IF
OPEN WININI$ FOR INPUT AS 1
OPEN WINBACK$ FOR APPEND AS 2
WHILE EOF(1) = FALSE
LINE INPUT #1, LINHA$
PRINT #2,LINHA$
WEND
CLOSE 2
CLOSE 1
OPEN SYSINI$ FOR INPUT AS 1
OPEN SYSBACK$ FOR APPEND AS 2
WHILE EOF(1) = FALSE
LINE INPUT #1, LINHA$
PRINT #2,LINHA$
WEND
CLOSE 2
CLOSE 1
End Sub